/**
 * 
 */
package dms.model.form;

import java.util.Date;

import dms.model.Building;

/**
 * 该类是招领启示，寻物启示的父类
 * @author 李健
 *
 */
abstract public class Notice {
	
	protected Long id;
	
	protected String description;
	
	protected ProcessStatus status;

	protected Building building;
	
	/**
	 * 获取启示发布人的姓名
	 * @return
	 */
	public abstract String getPerson();
	
	/**
	 * 设置启示发布人的姓名
	 * @param person
	 */
	public abstract void setPerson(String person);
	
	public void apply() {
		this.getStatus().setApplied(true);
		this.getStatus().setApplyDate(new Date());
	}
	
	
	/**
	 * @return the building
	 */
	public Building getBuilding() {
		return building;
	}

	/**
	 * @param building the building to set
	 */
	public void setBuilding(Building building) {
		this.building = building;
	}

	/**
	 * 
	 */
	public Notice() {
		super();
		ProcessStatus status = new ProcessStatus(true, false);
		status.setProcessDate(new Date());
		setStatus(status);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Notice other = (Notice) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	private void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the status
	 */
	public ProcessStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(ProcessStatus status) {
		this.status = status;
	}
	
	
}
